package chy.action;

import javax.annotation.Resource;

import com.opensymphony.xwork2.ActionSupport;

import chy.entity.Employee;
import chy.service.EmployeeService;



public class LoginAction extends ActionSupport {
	private String name;
	private String password;
	private String msg;
	private Employee employee;
	@Resource
	private EmployeeService employeeService;
	public String login() {
		employee=employeeService.getEmloyee(name, password);
		if(employee!=null) {
			if(employee.getStatus().equals("离职")) {
				setMsg("已离职ְ");
				return INPUT;
			}else{
				return SUCCESS;
			}
		}else {
			setMsg("失败");
			return INPUT;
		}
	}
	
	public Employee getEmployee() {
		return employee;
	}

	public void setEmployee(Employee employee) {
		this.employee = employee;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	
}
